package com.hwz.gulimall.product.web;

import com.hwz.gulimall.product.entity.CategoryEntity;
import com.hwz.gulimall.product.service.SkuInfoService;
import com.hwz.gulimall.product.vo.SkuItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @Author: hwz
 * @CreateTime: 2025-09-20
 */

@Controller
@Slf4j
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;


    @GetMapping({ "/{skuId}.html"})
    public String index(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println("准备查询" + skuId + "详情");
        SkuItemVo item = skuInfoService.item(skuId);
        model.addAttribute("item",item);


        return "item";
    }
}
